const Express = require("express");
const router = Express.Router();
const getAllDrive = require("../../servers/UsbInfo");

//获取U盘
router.get("/", async (req, res) => {
  try {
    const result = await getAllDrive();
    res.status(200).send({
      status: "ok",
      msg: "请求成功",
      data: result,
      code: 200,
    });
  } catch (err) {
    res.status(500).send({
      status: "fail",
      msg: "请求失败",
      data: err,
      code: 200,
    });
  }
});

//弹出U盘
router.post("/uninstallUsb", async (req, res) => {
  try {
    res.status(200).send({
      status: "ok",
      msg: "请求成功",
      code: 200,
    });
  } catch (err) {
    res.status(500).send({
      status: "fail",
      msg: "请求失败",
      data: err,
      code: 200,
    });
  }
});

module.exports = router;
